package com.kly.enums;

public enum ProductStatus {
    UNABLE(0, "无效"),

    ENABLE(1, "有效"),

    ;
    private int status;
    private String description;

    ProductStatus(int status, String description) {
        this.status = status;
        this.description = description;
    }

    public static ProductStatus fromType(int status) {
        if (status == 0) {
            return null;
        }
        for (ProductStatus orderStatus : values()) {
            if (orderStatus.getStatus() == status) {
                return orderStatus;
            }
        }
        return null;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
